﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLCH_ANUONG.Forms
{
    public partial class frmInBaoCao : Form
    {
        public frmInBaoCao()
        {
            InitializeComponent();
        }

        private void frmInBaoCao_Load(object sender, EventArgs e)
        {

        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
            {
                string strNgay = dateTimePicker1.Value.Day + "/" + dateTimePicker1.Value.Month + "/" + dateTimePicker1.Value.Year;
                DateTime Ngay = Convert.ToDateTime(strNgay);
                strNgay = Ngay.ToString("yyyy/MM/dd");
                string strSQL = "ALTER proc [dbo].[proc_load_baocaotongketchitiet] as exec proc_load_baocaochitiet " + "'" + strNgay + "'";
                clsMain.intBaoCaoThang = dateTimePicker1.Value.Month;
                ADODB.Recordset Rs = new ADODB.Recordset();
                Rs.Open(strSQL, clsMain.flexConn.fcConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, -1);
                xtrBANGLUONGCHITIET xtr = new xtrBANGLUONGCHITIET();
                xtr.ShowPreview();
            }
            else
            {
                string strNgay = dateTimePicker1.Value.Day + "/" + dateTimePicker1.Value.Month + "/" + dateTimePicker1.Value.Year;
                DateTime Ngay = Convert.ToDateTime(strNgay);
                strNgay = Ngay.ToString("yyyy/MM/dd");
                string strSQL = "ALTER proc [dbo].[proc_load_baocaoluongthang] as exec proc_load_baocaoluong '" + strNgay + "'";
                clsMain.intBaoCaoThang = dateTimePicker1.Value.Month;
                ADODB.Recordset Rs = new ADODB.Recordset();
                Rs.Open(strSQL, clsMain.flexConn.fcConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, -1);
                xtrBangLuong xtr = new xtrBangLuong();
                xtr.ShowPreview();
            }
        }
        
    }
}
